// src/api/axios.ts
import axios from 'axios'

const apiClient = axios.create({
  baseURL: import.meta.env.VITE_API_BASE_URL, // 替换为你的后端地址
  headers: {
    'Content-Type': 'application/json',
  },
})


// 添加一个请求拦截器
apiClient.interceptors.request.use(config => {
  const token = localStorage.getItem('token')
  if (token) {
    config.headers.token = token
  }
  return config
})

export default apiClient
